package com.yunji.hushuang.simplefactory;

import com.yunji.hushuang.control.IControl;
import com.yunji.hushuang.control.win.WinButton;
import com.yunji.hushuang.control.win.WinText;

/**
 * 小米工厂，刚成立，能生产所有的小米手机
 *
 * @author hushuang
 * @since 2019/9/26
 */
public class ControlFactory {

    public static IControl create(String control) {
        switch (control) {
            case "button":
                return new WinButton();
            case "text":
                return new WinText();
            default:
                throw new IllegalArgumentException("不支持的类型");
        }
    }
}
